package com.blrs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.blrs.common.annotation.Log;
import com.blrs.common.core.controller.BaseController;
import com.blrs.common.core.domain.AjaxResult;
import com.blrs.common.enums.BusinessType;
import com.blrs.domain.EnterpriseShareLogDetail;
import com.blrs.service.enterprise.sharelogdetail.IEnterpriseShareLogDetailService;
import com.blrs.common.utils.poi.ExcelUtil;
import com.blrs.common.core.page.TableDataInfo;

/**
 * 客户资源共享日志详情Controller
 * 
 * @author wang.chao
 * @date 2024-04-22
 */
@RestController
@RequestMapping("/enterprisesharelogdetail/detail")
public class EnterpriseShareLogDetailController extends BaseController
{
    @Autowired
    private IEnterpriseShareLogDetailService enterpriseShareLogDetailService;

    /**
     * 查询客户资源共享日志详情列表
     */
    @GetMapping("/list")
    public TableDataInfo list(EnterpriseShareLogDetail enterpriseShareLogDetail)
    {
        startPage();
        List<EnterpriseShareLogDetail> list = enterpriseShareLogDetailService.selectEnterpriseShareLogDetailList(enterpriseShareLogDetail);
        return getDataTable(list);
    }

    /**
     * 导出客户资源共享日志详情列表
     */
    @Log(title = "客户资源共享日志详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EnterpriseShareLogDetail enterpriseShareLogDetail)
    {
        List<EnterpriseShareLogDetail> list = enterpriseShareLogDetailService.selectEnterpriseShareLogDetailList(enterpriseShareLogDetail);
        ExcelUtil<EnterpriseShareLogDetail> util = new ExcelUtil<EnterpriseShareLogDetail>(EnterpriseShareLogDetail.class);
        util.exportExcel(response, list, "客户资源共享日志详情数据");
    }

    /**
     * 获取客户资源共享日志详情详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(enterpriseShareLogDetailService.selectEnterpriseShareLogDetailById(id));
    }

    /**
     * 新增客户资源共享日志详情
     */
    @Log(title = "客户资源共享日志详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EnterpriseShareLogDetail enterpriseShareLogDetail)
    {
        return toAjax(enterpriseShareLogDetailService.insertEnterpriseShareLogDetail(enterpriseShareLogDetail));
    }

    /**
     * 修改客户资源共享日志详情
     */
    @Log(title = "客户资源共享日志详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EnterpriseShareLogDetail enterpriseShareLogDetail)
    {
        return toAjax(enterpriseShareLogDetailService.updateEnterpriseShareLogDetail(enterpriseShareLogDetail));
    }

    /**
     * 删除客户资源共享日志详情
     */
    @Log(title = "客户资源共享日志详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(enterpriseShareLogDetailService.deleteEnterpriseShareLogDetailByIds(ids));
    }
}
